/**
 * 
 */
package common;

import model.Asteroid;
import model.BrickWall;
import model.DamageUpgrade;
import model.ForceField;
import model.HealthUpgrade;
import model.Item;
import model.LargeCanon;
import model.LargeHomingMissile;
import model.LargeTurret;
import model.Mine;
import model.RapidFireTurret;
import model.RepairUpgrade;
import model.SlowingCanon;
import model.SmallCanon;
import model.SmallHomingMissile;
import model.SmallLaser;
import model.SmallTurret;
import model.SpikeTrap;
import model.WoodWall;

/**
 * Creates Item objects 
 *
 */
public class ItemFactory {

	/**
	 * Creates an Item object given the image's file name and places it at the coordinate specified
	 * @param imageFileName
	 * @param coordinates
	 * @return
	 */
	public static Item createItemFromImageName(String imageFileName, GridCoordinate coordinates){
		if(imageFileName == DataManager.SMALL_TURRET) return new SmallTurret(coordinates);
		else if(imageFileName == DataManager.LARGE_TURRET) return new LargeTurret(coordinates);
		else if(imageFileName == DataManager.SLOWING_CANON) return new SlowingCanon(coordinates);
		else if(imageFileName == DataManager.RAPID_FIRE_TURRET) return new RapidFireTurret(coordinates);
		else if(imageFileName == DataManager.SMALL_LASER) return new SmallLaser(coordinates);
		else if(imageFileName == DataManager.SPIKE_TRAP) return new SpikeTrap(coordinates);
		else if(imageFileName == DataManager.BRICK_WALL) return new BrickWall(coordinates);
		else if(imageFileName == DataManager.WOOD_WALL) return new WoodWall(coordinates);
		else if(imageFileName == DataManager.FORCE_FIELD) return new ForceField(coordinates);
		else if(imageFileName == DataManager.MINE) return new Mine(coordinates);
		else if(imageFileName == DataManager.SMALL_CANON) return new SmallCanon(coordinates);
		else if(imageFileName == DataManager.LARGE_CANON) return new LargeCanon(coordinates);
		else if(imageFileName == DataManager.ASTEROID) return new Asteroid(coordinates);
		else return null;
	}
	
	/**
	 * Creates an Item object given the image's file name and does not place it on the map
	 * @param imageFileName
	 * @return
	 */
	public static Item createItemFromImageName(String imageFileName){
		if(imageFileName == DataManager.SMALL_TURRET) return new SmallTurret();
		else if(imageFileName == DataManager.LARGE_TURRET) return new LargeTurret();
		else if(imageFileName == DataManager.SLOWING_CANON) return new SlowingCanon();
		else if(imageFileName == DataManager.RAPID_FIRE_TURRET) return new RapidFireTurret();
		else if(imageFileName == DataManager.SMALL_LASER) return new SmallLaser();
		else if(imageFileName == DataManager.SPIKE_TRAP) return new SpikeTrap();
		else if(imageFileName == DataManager.BRICK_WALL) return new BrickWall();
		else if(imageFileName == DataManager.WOOD_WALL) return new WoodWall();
		else if(imageFileName == DataManager.FORCE_FIELD) return new ForceField();
		else if(imageFileName == DataManager.MINE) return new Mine();
		else if(imageFileName == DataManager.SMALL_CANON) return new SmallCanon();
		else if(imageFileName == DataManager.LARGE_CANON) return new LargeCanon();
		else if(imageFileName == DataManager.SMALL_HOMING_MISSILE) return new SmallHomingMissile();
		else if(imageFileName == DataManager.LARGE_HOMING_MISSILE) return new LargeHomingMissile();
		else if(imageFileName == DataManager.ASTEROID) return new Asteroid();
		else if(imageFileName == DataManager.HEALTH_UPGRADE) return new HealthUpgrade();
		else if(imageFileName == DataManager.REPAIR_UPGRADE) return new RepairUpgrade();
		else if(imageFileName == DataManager.DAMAGE_UPGRADE) return new DamageUpgrade();
		else return null;
	}
	
}
